deploy{
  final DeploymentUnit deploymentUnit=phaseContext.getDeploymentUnit();
  BeansXmlParser parser=new BeansXmlParser();
  Set<BeanArchiveMetadata> beanArchiveMetadata=new HashSet<BeanArchiveMetadata>();
  ResourceRoot deploymentRoot=deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
  ResourceRoot classesRoot=null;
  List<ResourceRoot> structure=deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS);
    if (ModuleRootMarker.isModuleRoot(resourceRoot) && !SubDeploymentMarker.isSubDeployment(resourceRoot)) {
      if (resourceRoot.getRootName().equals("classes")) {
        classesRoot=resourceRoot;
        VirtualFile beansXml=resourceRoot.getRoot().getChild(META_INF_BEANS_XML);
        if (beansXml.exists() && beansXml.isFile()) {
          beanArchiveMetadata.add(new BeanArchiveMetadata(beansXml,resourceRoot,parseBeansXml(beansXml,parser,deploymentUnit),false));
  if (DeploymentTypeMarker.isType(DeploymentType.WAR,deploymentUnit)) {
    final VirtualFile rootBeansXml=deploymentRoot.getRoot().getChild(WEB_INF_BEANS_XML);
    if (rootBeansXml.exists() && rootBeansXml.isFile() && classesRoot != null) {
      beanArchiveMetadata.add(new BeanArchiveMetadata(rootBeansXml,classesRoot,parseBeansXml(rootBeansXml,parser,deploymentUnit),true));
      VirtualFile beansXml=classesRoot.getRoot().getChild(META_INF_BEANS_XML);
      if (beansXml.exists() && beansXml.isFile()) {
        WeldLogger.DEPLOYMENT_LOGGER.beansXmlInNonStandardLocation(beansXml.toString());
        beanArchiveMetadata.add(new BeanArchiveMetadata(beansXml,classesRoot,parseBeansXml(beansXml,parser,deploymentUnit),true));
 else   if (!DeploymentTypeMarker.isType(DeploymentType.EAR,deploymentUnit)) {
    final VirtualFile rootBeansXml=deploymentRoot.getRoot().getChild(META_INF_BEANS_XML);
    if (rootBeansXml.exists() && rootBeansXml.isFile()) {
      beanArchiveMetadata.add(new BeanArchiveMetadata(rootBeansXml,deploymentRoot,parseBeansXml(rootBeansXml,parser,deploymentUnit),true));
  if (!beanArchiveMetadata.isEmpty()) {
    WeldDeploymentMetadata deploymentMetadata=new WeldDeploymentMetadata(beanArchiveMetadata);
    deploymentUnit.putAttachment(WeldDeploymentMetadata.ATTACHMENT_KEY,deploymentMetadata);
      WeldDeploymentMarker.mark(deploymentUnit.getParent());
}
undeploy{ }
parseBeansXml{
 catch (  MalformedURLException e) {
    throw WeldMessages.MESSAGES.couldNotGetBeansXmlAsURL(beansXmlFile.toString(),e);
}
